<%@ Page Language="C#" AutoEventWireup="true" CodeFile="kiennghi.aspx.cs" Inherits="Telerik.GridExamplesCSharp.DataEditing.AllEditableColumns.thongtinkhac_kiennghi" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
     <style type="text/css">
        .MyImageButton
        {
           cursor: hand;
        }
        .EditFormHeader td
        {
            font-size: 14px;
            padding: 4px !important;
            color: #0066cc;
        }
        </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        
            <p id="divMsgs" runat="server">
        <asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080"></asp:Label>
        <asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000"></asp:Label>
            </p>
            
         <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">
            function RowDblClick(sender, eventArgs)
            {
              sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
            </script>

        </telerik:RadCodeBlock>
        <!-- load ajax-->
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid_Xlsp">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid_XLsp" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="divMsgs" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        <!-- end-->
        
        
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
            BackColor="#99FF66" Skin="WebBlue" />
        <telerik:RadGrid ID="RadGrid_XLsp" runat="server" AllowPaging="True" 
            AllowSorting="True" CellSpacing="0" DataSourceID="SqlDataSource_sp1" 
            GridLines="None" AllowAutomaticDeletes="True" AutoGenerateColumns="False"
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" OnItemUpdated="RadGrid_XLsp_ItemUpdated"
             
           OnItemInserted="RadGrid_XLsp_ItemInserted" OnDataBound="RadGrid_XLsp_DataBound" Skin="Telerik">
                <HeaderContextMenu></HeaderContextMenu>

                <MasterTableView AutoGenerateColumns="False" DataKeyNames="makienngh" 
                                DataSourceID="SqlDataSource_sp1" CommandItemDisplay="Top">
                                
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>

                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>

    <Columns>
    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        <ItemStyle CssClass="MyImageButton" />
                    </telerik:GridEditCommandColumn>
                    
        <telerik:GridBoundColumn DataField="masp" DataType="System.Int32"  Visible="false"
            FilterControlAltText="Filter makienngh column" HeaderText="makienngh" ReadOnly="True" 
            SortExpression="makienngh" UniqueName="makienngh">
        </telerik:GridBoundColumn>
        
           <telerik:GridTemplateColumn HeaderText="STT">
                       <ItemTemplate>
                        <asp:Label runat="server" ID="lblSTT" Text='<%#i++%>'></asp:Label>
                       </ItemTemplate>
           </telerik:GridTemplateColumn>
        
       
        
        <telerik:GridDropDownColumn DataField="Madnghiep" DataSourceID="sp_dn"
                        HeaderText="Doanh nghiep" ListTextField="TenDN" ListValueField="Madnghiep"
                        UniqueName="Madnghiep" ColumnEditorID="GridDropDownColumnEditor1">
        </telerik:GridDropDownColumn>
        
        
        <telerik:GridBoundColumn DataField="Kiennghi" 
            FilterControlAltText="Filter Tensp column" HeaderText="Kien nghi" 
            SortExpression="Kiennghi" UniqueName="Kiennghi">
        </telerik:GridBoundColumn>
        
        
        <telerik:GridButtonColumn ConfirmText="Delete this sanpham?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
    </Columns>

            <EditFormSettings EditFormType="Template" ColumnNumber="2" CaptionDataField="Madnghiep" CaptionFormatString="Edit properties of Product {0}" InsertCaption="New Sanpham">
            
<EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
            
                <FormTemplate>
                
                    <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
                    style="border-collapse: collapse; background: white;" >
                        <tr class="EditFormHeader">
                            <td colspan="2" style="font-size: small">
                                <b>Nhap thong tin: KIEN NGHI</b>
                            </td>
                        </tr>                      
                        <tr>
                            <td>
                                <table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0" class="module">
                             <tr>
                <td>Doanh nghiep:</td>
                <td>
                    <asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("Madnghiep") %>'
        DataTextField="TenDN" TabIndex="7" DataValueField="Madnghiep" DataSourceID="sp_dn" AppendDataBoundItems="True">
                    <asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>
                    </asp:DropDownList>
                </td>
                </tr>
                <tr>
                <td>Kien nghi:</td>
                <td>
                    <telerik:RadEditor ID="RadEditor1" runat="server" Width="390px" Height="182px">
                     <Tools>
                    <telerik:EditorToolGroup Tag="MainToolbar">
                        <telerik:EditorSplitButton Name="Undo">
                        </telerik:EditorSplitButton>
                        <telerik:EditorSplitButton Name="Redo">
                        </telerik:EditorSplitButton>
                        <telerik:EditorTool Name="Cut" />
                        <telerik:EditorTool Name="Copy" />
                        <telerik:EditorTool Name="Paste" ShortCut="CTRL+V" />
                    </telerik:EditorToolGroup>
                    <telerik:EditorToolGroup Tag="Formatting">
                        <telerik:EditorTool Name="Bold" />
                        <telerik:EditorTool Name="Italic" />
                        <telerik:EditorTool Name="Underline" />
                        <telerik:EditorSeparator />
                        <telerik:EditorSplitButton Name="ForeColor">
                        </telerik:EditorSplitButton>
                        <telerik:EditorSplitButton Name="BackColor">
                        </telerik:EditorSplitButton>
                        <telerik:EditorSeparator />
                        <telerik:EditorDropDown Name="FontName">
                        </telerik:EditorDropDown>
                        <telerik:EditorDropDown Name="RealFontSize">
                        </telerik:EditorDropDown>
                    </telerik:EditorToolGroup>
                </Tools>
                <Content></Content>        
                </telerik:RadEditor>
                </td>
                </tr>
                                </table>
                            </td>
                        </tr>
                         
                        <tr>
                            <td align="right" colspan="2">
                                 <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                </asp:Button>&nbsp;
                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                        CommandName="Cancel"></asp:Button>
                            </td>
                        </tr>
                    </table>
                </FormTemplate>
            </EditFormSettings>
           </MasterTableView>
           <ClientSettings EnableRowHoverStyle="true">
               <Selecting AllowRowSelect="True" />
               <ClientEvents OnRowDblClick="RowDblClick" />
           </ClientSettings>


<FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="SqlDataSource_sp1" runat="server"
          ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" ProviderName="System.Data.SqlClient"
          SelectCommand="SELECT *from Kiennghi where Madnghiep=@Madnghiep"
           DeleteCommand="DELETE FROM [Kiennghi] WHERE [makienngh] = @original_makienngh"
           InsertCommand="INSERT INTO Kiennghi(Madnghiep, Kiennghi) VALUES (@Madnghiep,@Kiennghi)"
           UpdateCommand="UPDATE [Kiennghi] SET [Madnghiep] = @Madnghiep, [Kiennghi] = @Kiennghi WHERE [makienngh] = @original_makienngh"
           
          OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
         
          <SelectParameters>
        <asp:QueryStringParameter Name="Madnghiep" QueryStringField="_iddn"  ConvertEmptyStringToNull="true"/>
     </SelectParameters> 
          <DeleteParameters>
               <asp:Parameter Name="original_makienngh" Type="Int32" />
           </DeleteParameters>
           <UpdateParameters>
               <asp:Parameter Name="Madnghiep" Type="Int32" />
               <asp:Parameter Name="Kiennghi" Type="String" />
               
               
               <asp:Parameter Name="original_makienngh" Type="Int32" />
               
               
           </UpdateParameters>
           <InsertParameters>                
               
               <asp:Parameter Name="Madnghiep" Type="Int32" />
               <asp:Parameter Name="Kiennghi" Type="String" />
              
           </InsertParameters>
          
      </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource_XLsp" runat="server" 
            ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
            SelectCommand="SELECT [makienngh], [Kiennghi] FROM [Kiennghi]">
        </asp:SqlDataSource>
        
         <asp:SqlDataSource ID="sp_dn" runat="server" 
           ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
           SelectCommand="SELECT * FROM [Doanhnghiep] where Madnghiep=@Madnghiep">
            <SelectParameters>
        <asp:QueryStringParameter Name="Madnghiep" QueryStringField="_iddn"  ConvertEmptyStringToNull="true"/>
     </SelectParameters>
         </asp:SqlDataSource>
        
               <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="200px" />
       <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor2" runat="server" TextBoxStyle-Width="150px" />
       <telerik:GridDropDownListColumnEditor ID="GridDropDownColumnEditor1" runat="server" DropDownStyle-Width="110px" />
       <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server" NumericTextBox-Width="40px" />
    </div>
    </form>
</body>
</html>
